'use strict';

function* gen() {
     yield  123 + 456;
  }
// const ge = gen();

// ge.next();
// console.log(ge.next());


function* foo(x) {
    var y = 2 * (yield (x + 1));
    var z = yield (y / 3);
    return (x + y + z);
  }

  try {
      
  } catch (e) {
      
  }
  
  var a = foo(5);
  const n1 = a.next() // Object{value:6, done:false}
  console.log(n1);
  console.log(a.next()); // Object{value:NaN, done:false}
  console.log(a.next());// Object{value:NaN, done:true}
  
  var b = foo(5);
  b.next() // { value:6, done:false }
  b.next(12) // { value:8, done:false }
  b.next(13) // { value:42, done:true }